package com.qipay.mapper;

import com.qipay.baas.model.ActionDocDetail;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.type.JdbcType;

import java.util.List;

public interface ActionDocDetailMapper extends com.qipay.baas.mapper.ActionDocDetailMapper {

    @Select({
            "select",
            "id, doc_id, title, pid, create_time,parnt_cate_name, info",
            "from action_doc_detail",
            "where doc_id = #{docId,jdbcType=INTEGER}"
    })
    @Results({
            @Result(column="id", property="id", jdbcType= JdbcType.INTEGER, id=true),
            @Result(column="doc_id", property="docId", jdbcType=JdbcType.INTEGER),
            @Result(column="title", property="title", jdbcType=JdbcType.VARCHAR),
            @Result(column="pid", property="pid", jdbcType=JdbcType.INTEGER),
            @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
            @Result(column="parnt_cate_name", property="parntCateName", jdbcType=JdbcType.VARCHAR),
            @Result(column="info", property="info", jdbcType=JdbcType.LONGVARCHAR)
    })
    List<ActionDocDetail> selectByDocId(int docId);

    @Select({
            "select",
            "id, doc_id, title, pid, create_time,parnt_cate_name, info",
            "from action_doc_detail",
            "where doc_id = #{docId,jdbcType=INTEGER} and pid=#{pid,jdbcType=INTEGER}"
    })
    @Results({
            @Result(column="id", property="id", jdbcType= JdbcType.INTEGER, id=true),
            @Result(column="doc_id", property="docId", jdbcType=JdbcType.INTEGER),
            @Result(column="title", property="title", jdbcType=JdbcType.VARCHAR),
            @Result(column="pid", property="pid", jdbcType=JdbcType.INTEGER),
            @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
            @Result(column="parnt_cate_name", property="parntCateName", jdbcType=JdbcType.VARCHAR),
            @Result(column="info", property="info", jdbcType=JdbcType.LONGVARCHAR)
    })
    List<ActionDocDetail> selectByDocIdAndPid(int docId,int pid);

    @Select({
            "select",
            "id, doc_id, title, pid, create_time,parnt_cate_name",
            "from action_doc_detail"
    })
    @Results({
            @Result(column="id", property="id", jdbcType= JdbcType.INTEGER, id=true),
            @Result(column="doc_id", property="docId", jdbcType=JdbcType.INTEGER),
            @Result(column="title", property="title", jdbcType=JdbcType.VARCHAR),
            @Result(column="pid", property="pid", jdbcType=JdbcType.INTEGER),
            @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
            @Result(column="parnt_cate_name", property="parntCateName", jdbcType=JdbcType.VARCHAR)
    })
    List<ActionDocDetail> selectSmartAll();
}
